package OOPS;

abstract class Shape {
	public static float length;

	Shape(float length) {
		this.length = length;
		System.out.println("** Shape(float) Cons **");
	}

	static void displayMessage() {
		System.out.println("== static member of abstract class ==");
	}

	abstract void displayArea();

	void showValue() {
	}

	public float getLength() {
		return this.length;
	}

	{
		System.out.println("== Instance block of abstract class shape ==");
	}
	static {
		System.out.println("== static block of abstract class shape ==");
	}
}

/*
 * class Circle extends Shape{ Circe(float length){ super(length); } }
 */
abstract class FourSidedShape extends Shape {
	FourSidedShape(float length) {
		super(length);
	}
}

class Square extends FourSidedShape {
	Square(float length) {
		super(length);
		System.out.println("** Square(float) Cons **");
	}

	{
		System.out.println("== Instance block of Square ==");
	}
	static {
		System.out.println("== static block of Square ==");
	}

	void displayArea() {
		System.out.println("~~ Area of Square ~~");
		System.out.println(getLength() * getLength());
	}
}

class Rectangle extends FourSidedShape {
	private float width;

	Rectangle(float lenth, float width) {
		super(length);
		this.width = width;
		System.out.println("** Rectangle(float,float) cons **");
		{
			System.out.println("== Instance block of Rectangle ==");
		}
		{
			System.out.println("== static block of Rectangle ==");
		}
	}

	void displayArea() {
		System.out.println("~~ Area of Rectangle ~~");
		System.out.println(getLength() * width);
	}

	void showValue() {
		System.out.println("------------ Rectangle  ----------------");
		System.out.println("Length:\t" + getLength());
		System.out.println("width:\t" + width);
	}
}

class Test60 {
	public static void main(String str[]) {
		Shape sp = null;
		// sp=new Shape();
		Shape.displayMessage();
		Square sq = new Square(12.0F);
		sq.displayArea();
		sq.showValue();
		Rectangle rec = new Rectangle(14.0F, 10.0F);
		rec.displayArea();
		rec.showValue();
		System.out.println("OK");
	}
}